{
  "properties" : { },
  "id" : "def8d8ae92444aa680e6c84dc14d6919",
  "script" : null,
  "groupId" : "5b4c0f1fcedc4bfbbf84bb3791e01399",
  "name" : "批量解绑",
  "createTime" : 1727070938614,
  "updateTime" : 1726304732087,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "batchUnbind",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n    \"targetId\": \"689,843,897,921,1015,671,721,748,961\",\n    \"ruleId\": \"9\"\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import redis

    sql1 = """ 
        select met.code from alarm_rule ru
        left join alarm_metric met on met.id = ru.rule_metric_id
        where ru.id = #{body.ruleId} 
    """
    metric = db.selectOne(sql1)
	if (metric != null) {
        redis.delete("ndmp-alarm-rule:" + metric.code)
    }
    ids = body.targetId
    idList = ids.split(",")
    sql2 = """
        delete from alarm_rule_target where rule_id = #{body.ruleId} and target_id in
        <foreach collection="idList" open="(" separator="," close=")" item="item">
            #{item}
        </foreach>
    """
	return db.update(sql2)